﻿using System.Web.Mvc;

namespace ShopB2C.Controllers.Brower {
    public class AreaRouting : AreaRegistration {
        public override string AreaName {
            get { return "Website"; }
        }

        public override void RegisterArea(AreaRegistrationContext context) {

            #region Static

            context.MapRoute(
                "Website_HomePage"
                , "Website/Default.aspx"
                , new { controller = "Home", action = "Index" }
            );
            // 登录
            context.MapRoute("Login"
                , "Website/Login.aspx"
                , new { controller = "Home", action = "Login" }
                );
            // 登录2
            context.MapRoute("Login2"
                , "Login.aspx"
                , new { controller = "Home", action = "Login" }
            );
            // 退出
            context.MapRoute("LogOut"
                , "Website/LogOut.aspx"
                , new { controller = "Home", action = "LognOut" }
                 );

            #endregion

            #region News

            // 新闻详细
            context.MapRoute("Website_NewsView_Page"
                , "Website/News/View-{id}.aspx"
                , new { controller = "News", action = "View", id = 0 }
                );

            // AJAX 新闻列表，带分页和分类的
            context.MapRoute("Website_NewsList_Page"
                , "Website/NewsListByClassify/P{pageIndex}-C{classId}.aspx"
                , new { controller = "News", action = "NewsListByClassify", pageIndex = 1, classId = 0 }
                );

            #endregion

            #region Product

            // 商品咨询
            context.MapRoute("Website_ConsultList_Page"
                , "Website/ConsultList-{productId}-{consultId}-{pageIndex}.aspx"
                , new { controller = "Consult", action = "ConsultList", productId = 0, consultId = 0, pageIndex = 1 }
                );
            // 发表评论
            context.MapRoute("Website_CommentAppend_Page"
                , "Website/CommentEdit-{productId}-{commentId}-{reCommentId}.aspx"
                , new { controller = "Comment", action = "CommentEdit", productId = 0, commentId = 0, reCommentId = 0 }
                );
            // 商品评论
            context.MapRoute("Website_CommentList_Page"
                , "Website/CommentList-{commentParams}.aspx"
                , new { controller = "Comment", action = "CommentList" }
                );
            // 商品列表
            context.MapRoute("Website_ProductList_Page"
                , "Website/Product-{productParams}.aspx"
                , new { controller = "Product", action = "ProductList" }
                );
            //商品列表
            context.MapRoute("Website_ProductList"
                , "Website/Product.aspx"
                , new { controller = "Product", action = "ProductList" }
                );
            // 商品预览
            context.MapRoute(
                "Website_ProductView"
                , "Website/ProductView-{ProductId}.aspx"
                , new { controller = "Product", action = "PreView" }
                );

            #endregion

            #region Help

            // 帮助详细
            context.MapRoute("Website_HelpView_Page"
                , "Website/Help/View-{id}.aspx"
                , new { controller = "Help", action = "View", id = 0 }
                );

            #endregion

            #region Default

            context.MapRoute(
                "Website_Default1",
                "Website/{controller}.aspx",
                new {
                    action = "Index"
                });

            context.MapRoute(
                "Website_Default0",
                "Website/{controller}/{action}/{id}.aspx");

            context.MapRoute(
                "Website_Default",
                "Website/{controller}/{action}.aspx",
                new {
                    controller = "Home"
                });

            #endregion
        }
    }
}